#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <opencv2/opencv.hpp>
#include <QTimer>
#include <baiduface.h>
#include <QMap>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlRecord>
#include <QtSql/QSqlError>
#include <QSound>
#include <QSqlQueryModel>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    void DetectFace(cv::Mat& img);
    void IsFoundFace(bool yes);
    void sleep(int msec);
    int SignInEffTimes(QString _uid);
    void UpdateDbInfo(QString _uid);
    bool FitInterval(QString _uid);

private slots:
    void UpdatePic();

    void on_infoBtn_clicked();

    void on_pushButton_clicked();

private:
    Ui::Widget *ui;
    cv::VideoCapture video;
    QTimer* timer;
    cv::Ptr<cv::CascadeClassifier> classifier;
    baiduFace* bdf;
    QString group;
    QMap<QString,int> map;
    QSqlDatabase db;
    QSound *sound;
    QSqlQueryModel * model;
    bool IsShow;
};
#endif // WIDGET_H
